/**
 * Created by Administrator on 2019/3/6.
 */
$(document).ready(function () {



    $('.navbar-search').hover(function () {
        $('#searchInput').animate({'opacity':'0.8'},500)
    },function () {
        $('#searchInput').animate({'opacity':0},500)

    });

    $('.panel-heading').on('click',function(e){
        if($(this).parents('.panel').children('.panel-collapse').hasClass('in')){
            return false;
        }
    });



    var collapseSize = 1299;

    $(document).on('show.bs.dropdown', function(obj) {
        if ($(window).width() <= collapseSize) {
            $(obj.target).parents('.show-on-hover').addClass('open');
        }
    });
    $('.navbar a:not(.dropdown-toggle)').click( function(e) {

        $this = $(e.target);
        href = $this.attr('href'); // Link URL

        // Check link value
        if (href === undefined || !href.length || href === '#' || href === 'javascript:;') {
            href = false;
        }
        // Link behavior
        if ($(window).width() > collapseSize) {
            if (href) {
                // large screens, follow the parent menu link when clicked
                if (e.which !== 2) {
                    window.location.href = href;
                }
            }
        } else if ( $this.parent().hasClass('open') && href !== false) {
            // small screens, 1st tap opens sub-menu & 2nd tap follows link
            $(document).trigger('collapse-menus');
            window.location.href = href;
        }
    });
    // Close all menus
    $(document).on('collapse-menus', function () {
        $('.collapse.in').removeClass('in').children().removeClass('open');
    });
    // Hover styling helpers
    $('.navbar-nav > li.show-on-hover').hover(function() {
        if ($(window).width() > collapseSize) {
            $(this).addClass('open');
        }
    }, function() {
        if ($(window).width() > collapseSize) {
            $(this).removeClass('open');
        }
    });





    var boomHight = $(window).height()/2.5;
    $(document).scroll(function () {


       if($(document).scrollTop() >boomHight){
           $('.headerTop').css('display','none');
           $('.header').css('background','#333')
       }else {
           $('.headerTop').css('display','block')
           $('.header').css('background','rgba(34, 35, 36, 0.6)')
       }

    })
















});
